package com.mzy.linear_struct.hot100.动态规划;

/**
 * @Author: mizy3
 * @Date: 2024/08/18/上午1:01
 * @Description:
 */
public class Pro674最长连续递增序列 {
    public int findLengthOfLCIS(int[] nums) {
        int ans = 1;
        int count = 0;
        for (int i = 1; i < nums.length; i++) {
            if (nums[i - 1] < nums[i]) {
                count++;
                ans = Math.max(count, ans);
            } else {
                count = 0;
            }
        }

        return ans;
    }

    /*public int findLengthOfLCIS(int[] nums) {

        // i表示当前位置，dp[i]表示当前位置最长连续递增的序列
        // [1,3,5,4,7]

        int[] dp = new int[nums.length];

        dp[0] = 1;
        dp[1] = nums[0] > nums[1] ? 0 : 2;
        int ans = dp[1];
        for (int i = 2; i < dp.length; i++) {
            dp[i] = nums[i] > nums[i - 1] ? dp[i - 1] + 1 : 1;
            ans = Math.max(ans, dp[i]);
            System.out.println(nums[i] + " " + dp[i]    );

        }

        return ans;
    }
*/


    public static void main(String[] args) {
        System.out.println(new Pro674最长连续递增序列().findLengthOfLCIS(new int[]{1, 3, 5, 4, 2, 3, 4, 5}));
    }
}
